//去除尾部空格
String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
//提示信息
function messagefadeout(){
	$("#flashMessage").addClass("info_correct_alert");
	if($("#addmessage").html()){
		$("#flashMessage").delay(3000).fadeOut(5000);
	}
}
function showmessage(str,flag){
	var thenew= document.createElement('div');
	$('#addmessage').html("");
	document.getElementById('addmessage').appendChild(thenew);
	$("#addmessage").children().html(str).delay(3000).fadeOut(5000);
	if(flag=='T' || flag==null){
		$("#addmessage").children().addClass("info_correct_alert");
	}else if(flag=='F'){
		$("#addmessage").children().addClass("info_error_alert");	
	}
}
//图片弹层
function openimg(id)
{
	$("#"+id).dialog({
			autoOpen: false,
			width:890,
			height: 530,
			modal:true});
	$("#"+id).dialog("open");
}
//添加附件控件--项目引进
function addmore(divid) {
	if(divid!=null){
		var thenew= document.createElement('div');
		thenew.innerHTML ='<div class="file_add_box"><input type="file" id="upload[]" name="upload'+divid+'[]" /></div>';
		document.getElementById("add2"+divid).appendChild(thenew);
		$("#add2"+divid+" :file").uniform();
		return false;
	}
}
//删除附件控件--项目引进
function removemore(divid) {
	var child=document.getElementById("add2"+divid).lastChild;
	if(child){
		document.getElementById("add2"+divid).removeChild(child);
	}
	return false;
}
//添加附件控件--全局
function add() {
	var thenew= document.createElement('div');
	thenew.innerHTML ="<div class='file_add_box'><input type='file' name='upload[]'/></div>";
	document.getElementById("add2").appendChild(thenew);
	$("#add2 :file").uniform();
	return false;
}
//删除附件控件--全局
function remove() {
	var child=document.getElementById("add2").lastChild;
	if(child){
		document.getElementById("add2").removeChild(child);
	}
	return false;
}

//修改排序
function changevalue(obj,id,db,column){
	var webpath=$("#getpath").attr('href');
	var v=obj.value;
	if(v==""){
		v="-";
	}
	var urlpath=webpath+"searchs/changevalue/"+db+"/"+id+"/"+v+'/'+column+'/'+parseInt(10*Math.random());
	$.ajax({     	   
        url: urlpath, 
        success:function(data){
			showmessage("修改成功");
        }      
     });
}